<?php
namespace App\Services\Export;

use App\Services\Export\WordAbstract;

class WordRisk extends WordAbstract
{
    public function set($data = [],$riskData = [])
    {
        $blockNumber = count($riskData);
        $this->templateProcessor->cloneBlock('CLONEME', $blockNumber, true, true, null);
        if(count($data)) {
            foreach($data as $k=>$v) {
                if($k!=='comSignature') {
                    $this->templateProcessor->setValue($k, $v);
                } else {
                    if(!empty($data['comSignature'])) {
                         $this->templateProcessor->setImageValue($k, $v);
                    } else {
                         $this->templateProcessor->setValue($k, $v);
                    }
                }
              }
        }
        if($blockNumber) {
            foreach($riskData as $k=>$v) {
                foreach($v as $kk=>$vv) {
                    $this->templateProcessor->setValue($kk.'#'.($k+1), $vv);
                }
            }
            
        }
        
        
    }
}